<?php 
include "./congfig/config.php";
$username=$_POST["username"];
$email=$_POST["email"];
$passwd=$_POST["passwd"];
echo $username.$email;
$sql="select email from users where username = '$username'";
echo $sql;
$result=$conn->query($sql);
if($row=$result->fetch_array()){
	var_dump($row);
	if($email==$row["email"]){
		$sql1="UPDATE `users` SET`passwd`=md5($passwd) WHERE username = '$username'";
		var_dump($sql1);
		$result1=$conn->query($sql1);
		$text="密码修改成功！";
		header("location:UserForget.php?text=$text");
	}else{
		$text="邮箱输入错误";
	    header("location:UserForget.php?text=$text");
	}
}else{
	$text="用户名不存在";
	header("location:UserForget.php?text=$text");
}

 ?>